#!/usr/bin/perl -w

use strict;
use HTMLCreator;
use HaplotypeWrapper;

my $path = "/home/hani/BioProj/tests/project1/";
my $datFilePath = $path . "Project1.dat";
my $pedFilePath = $path . "Project1.ped";

#my $tool = $HaplotypeWrapper::HMM_TOOL;
#my $outputFile  = $path . "colouredHaplotypes.txt";
#my $allelesFile = $path . "haplotypes.txt";

my $tool = $HaplotypeWrapper::MORGAN_TOOL;
my $outputFile = $path . "output.txt";

#my $tool = $HaplotypeWrapper::HAPLOTYPING_TOOL;
#my $outputFile = "/home/hani/BioProj/Haplotyping_EXE/haplotypeLars.out";
#my $allelesFile = "/home/hani/BioProj/Haplotyping_EXE/haplotypeLars.out";


my $htmlCreator = new HTMLCreator("My Example Page", "styles.css");;
$htmlCreator->addSection("First Table");
$htmlCreator->addSection("Second Table");
$htmlCreator->addParagraph("&nbsp;&nbsp;&nbsp; This table shows the results of the tool:" . $tool , "First Table");
$htmlCreator->addParagraph("&nbsp;&nbsp;&nbsp; Some more description here", "First Table");
$htmlCreator->addParagraph("&nbsp;&nbsp;&nbsp; Alleles table", "Second Table");

-e $datFilePath || die "dat file $datFilePath  does not exist\n";

my $datWrapper = new DatWrapper($datFilePath);
my $pedWrapper = new PedWrapper($pedFilePath, $datWrapper->getNumOfMarkers());
	
my $HaploWrapper = new HaplotypeWrapper($tool, $datWrapper, $pedWrapper, 1);
		
		

my @arr1 = ();
for (my $marker = 1; $marker < $datWrapper->getNumOfMarkers(); ++$marker) {
	push(@arr1, $marker);
}
#my @arr2 = (4,5,6);
#my @arr3 = (7,8,9);
$HaploWrapper->readWindowToolOutput($outputFile,1,\@arr1);
#$HaploWrapper->readWindowToolOutput($outputFile,2,\@arr2);
#$HaploWrapper->readWindowToolOutput($outputFile,3,\@arr3);

#$HaploWrapper->readWindowAlleles($allelesFile,1,\@arr1);
#$HaploWrapper->readWindowAlleles($allelesFile,2,\@arr2);
#$HaploWrapper->readWindowAlleles($allelesFile,3,\@arr3);

$htmlCreator->addTable($HaploWrapper->getHaplotypingTable(), "First Table");
#$htmlCreator->addTable($HaploWrapper->getAllelesTable(), "Second Table");

$htmlCreator->exportHTML("results.html");
